package com.binest.hackathonInclusionMain.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.binest.common.annotation.Log;
import com.binest.common.core.controller.BaseController;
import com.binest.common.core.domain.AjaxResult;
import com.binest.common.enums.BusinessType;
import com.binest.hackathonInclusionMain.domain.HackathonInclusionMain;
import com.binest.hackathonInclusionMain.service.IHackathonInclusionMainService;
import com.binest.common.utils.poi.ExcelUtil;
import com.binest.common.core.page.TableDataInfo;

/**
 * 黑客马拉松收录主Controller
 * 
 * @author wwd
 * @date 2024-01-19
 */
@RestController
@RequestMapping("/hackathonInclusionMain")
public class HackathonInclusionMainController extends BaseController
{
    @Autowired
    private IHackathonInclusionMainService hackathonInclusionMainService;

    /**
     * 查询黑客马拉松收录主列表
     */
    @PreAuthorize("@ss.hasPermi('hackathonInclusionMain:hackathonInclusionMain:list')")
    @GetMapping("/list")
    public TableDataInfo list(HackathonInclusionMain hackathonInclusionMain)
    {
        startPage();
        List<HackathonInclusionMain> list = hackathonInclusionMainService.selectHackathonInclusionMainList(hackathonInclusionMain);
        return getDataTable(list);
    }

    /**
     * 导出黑客马拉松收录主列表
     */
    @PreAuthorize("@ss.hasPermi('hackathonInclusionMain:hackathonInclusionMain:export')")
    @Log(title = "黑客马拉松收录主", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, HackathonInclusionMain hackathonInclusionMain)
    {
        List<HackathonInclusionMain> list = hackathonInclusionMainService.selectHackathonInclusionMainList(hackathonInclusionMain);
        ExcelUtil<HackathonInclusionMain> util = new ExcelUtil<HackathonInclusionMain>(HackathonInclusionMain.class);
        util.exportExcel(response, list, "黑客马拉松收录主数据");
    }

    /**
     * 获取黑客马拉松收录主详细信息
     */
    @PreAuthorize("@ss.hasPermi('hackathonInclusionMain:hackathonInclusionMain:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(hackathonInclusionMainService.selectHackathonInclusionMainById(id));
    }

    /**
     * 新增黑客马拉松收录主
     */
    @PreAuthorize("@ss.hasPermi('hackathonInclusionMain:hackathonInclusionMain:add')")
    @Log(title = "黑客马拉松收录主", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody HackathonInclusionMain hackathonInclusionMain)
    {
        return toAjax(hackathonInclusionMainService.insertHackathonInclusionMain(hackathonInclusionMain));
    }

    /**
     * 修改黑客马拉松收录主
     */
    @PreAuthorize("@ss.hasPermi('hackathonInclusionMain:hackathonInclusionMain:edit')")
    @Log(title = "黑客马拉松收录主", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody HackathonInclusionMain hackathonInclusionMain)
    {
        return toAjax(hackathonInclusionMainService.updateHackathonInclusionMain(hackathonInclusionMain));
    }

    /**
     * 删除黑客马拉松收录主
     */
    @PreAuthorize("@ss.hasPermi('hackathonInclusionMain:hackathonInclusionMain:remove')")
    @Log(title = "黑客马拉松收录主", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(hackathonInclusionMainService.deleteHackathonInclusionMainByIds(ids));
    }
}
